{ See NextButtonClick and BackButtonClick: return True if the click should be allowed }
if not BackClicked then
Result := Next
else
Result := not Next;
{ Close the wizard page. Do a FullRestore only if the click (see above) is not allowed }
ScriptDlgPageClose(not Result);
end else if (not BackClicked and (CurPage = wpWelcome)) or (BackClicked and (CurPage = wpSelectDir)) then begin
{ Insert multiple custom wizard page between two non custom pages }
{ Now we must handle navigation between the custom pages ourselves }
{ First find out on which page we should start }
if not BackClicked then
CurSubPage := 0
else
CurSubPage := 2;
{ Then open the custom wizard page }
ScriptDlgPageOpen();
{ Set the main caption }
ScriptDlgPageSetCaption('Personal Information');
{ Loop while we are still on a custom page and Setup has not been terminated }
while (CurSubPage >= 0) and (CurSubPage <= 2) and not Terminated do begin
case CurSubPage of
0:
begin
{ First ask for some user info }
ScriptDlgPageSetSubCaption1('Who are you?');
ScriptDlgPageSetSubCaption2('Please specify your name and the company for whom you work, then click Next.');
Next := InputQueryArray(UserPrompts, UserValues);
if Next then begin
NextOk := UserValues[0] <> '';
if not NextOk then
MsgBox('You must enter your name.', mbError, MB_OK);
end;
end;
1:
begin
{ Then ask for the usage mode }
ScriptDlgPageSetSubCaption1('How will you use My Progam?');
ScriptDlgPageSetSubCaption2('Please specify how you would like to use My Program, then click Next.');
Next := InputOptionArray(UsagePrompts, UsageValues, True, False);
NextOk := True;
end;
2:
begin
if UsageValues[0] = '1' then begin
{ Show a message if 'light mode' was chosen above }
{ Skip this page when the user just clicked the Back button }
ScriptDlgPageSetSubCaption1('How will you use My Progam?');
Next := OutputMsg('Note: to enjoy all features My Program can offer and to support its development, you can switch to sponsored or paid mode at any time by selecting ''Usage Mode'' in the ''Help'' menu of My Program after the installation has completed.'#13#13'Click Back if you want to change your usage mode setting now, or click Next to continue with the installation.', True);
NextOk := True;
end else if UsageValues[2] = '1' then begin
{ Ask for a registration key if 'paid mode' was chosen above }
{ This demo accepts only one key: 'isx' (without quotes) }
ScriptDlgPageSetSubCaption1('What''s your registration key?');
ScriptDlgPageSetSubCaption2('Please specify your registration key, ' + UserValues[0] + '. Click Next to continue. If you don''t have a valid registration key, click Back to choose a different usage mode.');
Next := InputQuery('Registration key:', Key);
if Next then begin
{ Just to show how OutputProgress works }
for I := 0 to 10 do begin
OutputProgress('Authorizing registration key...', '', I, 10);
Sleep(100);
if Terminated then
Break;
end;
NextOk := Key = 'isx';
if not NextOk and not Terminated then
MsgBox('You must enter a valid registration key.', mbError, MB_OK);
end;
end;
end;
end;
if Next then begin
{ Go to the next page, but only if the user entered correct information }
if NextOk then
CurSubPage := CurSubPage + 1;
end else
CurSubPage := CurSubPage - 1;
end;
{ See NextButtonClick and BackButtonClick: return True if the click should be allowed }
if not BackClicked then
Result := Next
else
Result := not Next;
{ Close the wizard page. Do a FullRestore only if the click (see above) is not allowed }
ScriptDlgPageClose(not Result);
end else begin
Result := True;
end;
end;
function NextButtonClick(CurPage: Integer): Boolean;
begin
Result := ScriptDlgPages(CurPage, False);
end;
function BackButtonClick(CurPage: Integer): Boolean;